package com.api.shopapi.service.impl;

import com.api.shopapi.entity.OrderRefund;
import com.api.shopapi.mapper.OrderRefundMapper;
import com.api.shopapi.service.OrderRefundService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("OrderRefundServiceImplOne")
public class OrderRefundServiceImpl implements OrderRefundService {

    @Autowired
    private OrderRefundMapper orderRefundMapper;

    @Override
    public int insert(OrderRefund orderRefund) {
        return orderRefundMapper.insert(orderRefund);
    }

    @Override
    public int update(OrderRefund orderRefund) {
        return orderRefundMapper.update(orderRefund);
    }

    @Override
    public int delete(String orderRefundCode) {
        return orderRefundMapper.delete(orderRefundCode);
    }

    @Override
    public OrderRefund getByOrderRefundCode(String orderRefundCode) {
        return orderRefundMapper.getByOrderRefundCode(orderRefundCode);
    }

    @Override
    public OrderRefund getByOrderBusinessCode(String orderBusinessCode){
        return orderRefundMapper.getByOrderBusinessCode(orderBusinessCode);
    }

    @Override
    public PageInfo<OrderRefund> getPageList(int pageIndex, int pageSize, String userCode, String businessCode, String tradeNo, String refundNo, int status) {
        PageHelper.startPage(pageIndex,pageSize);
        List<OrderRefund> orderRefundList = orderRefundMapper.getPageList(userCode, businessCode,tradeNo,refundNo,status);
        PageInfo<OrderRefund> orderRefundPageInfo=new PageInfo<>(orderRefundList);
        return orderRefundPageInfo;
    }
}
